<template>
  <el-table :data="persons.data" border style="width: 100%">
    <el-table-column type="selection" width="55" />
    <el-table-column label="用户名" prop="username" />
    <el-table-column label="年龄" prop="age" sortable />
    <el-table-column label="性别" prop="sex" />



    <el-table-column align="center" label="操作" width="180">
      <template #default="scope">
        <el-button size="small" type="primary" :disabled="login.data.right == 'common'"
          @click="Edithandler(scope.$index, scope.row)">编辑</el-button>
        <el-button size="small" type="danger" :disabled="login.data.right == 'common'"
          @click="open(scope.$index, scope.row)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <!-- <div>
    <mypage :total="total" @current="getBooklist" @pageSize="getBooklist"></mypage>
  </div> -->
</template>
<script setup>
import axios from "axios";
import { ref, reactive, computed, onMounted, onBeforeMount } from "vue"; //导入需要的方法
const persons = reactive({

})
const login = reactive({

})
onBeforeMount(() => {
  console.log("onBeforeMount")
  login.data = JSON.parse(sessionStorage.getItem("user"));
})

onMounted(() => {
  axios.get("http://localhost:9090/software2201/persons").then((res) => {
    persons.data = res.data

  })
})
</script>
<style></style>
